package cn.itcast.firstmyapp.servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class MyHttpServlet2
 */
public class MyHttpServlet2 extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * 接受客户端发送的get请求
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// 获取请求方式
	    String method = request.getMethod();
	    System.out.println(method);
	    System.out.println("这是发送的get请求！！！");
	}

	/**
	 * 接受客户端发送的post请求
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	    // 获取请求方式
        String method = request.getMethod();
        System.out.println(method);
        System.out.println("这是发送的post请求！！！");
	}

}
